class Solution:
    def removeElement(self, nums: list[int], val: int) -> int:
        if not nums:
            return False
        n = len(nums)
        fast = slow = 0
        while fast<n:
            if nums[fast] != val:
                nums[slow] = nums[fast]
                slow +=1
            fast +=1
        return slow